/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50635
 Source Host           : localhost:8889
 Source Schema         : myblog_beego

 Target Server Type    : MySQL
 Target Server Version : 50635
 File Encoding         : 65001

 Date: 13/02/2020 17:58:12
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for article
-- ----------------------------
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
  `article_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文章id',
  `article_class_id` int(11) NOT NULL COMMENT '分类id',
  `title` varchar(255) NOT NULL COMMENT '文章标题',
  `content` text NOT NULL COMMENT '文章内容',
  `time` int(11) NOT NULL COMMENT '发布时间',
  `update_time` int(11) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`article_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1397 DEFAULT CHARSET=utf8 COMMENT='文章内容';

-- ----------------------------
-- Records of article
-- ----------------------------
BEGIN;
INSERT INTO `article` VALUES (20, 5, 'centos7中mysql编译安装', '<p>\n	一、下载mysql源码包\n</p>\n<p>\n	wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.43.tar.gz\n</p>\n<p>\n	解压：tar -zxvf mysql-5.6.43.tar.gz\n</p>\n<p>\n	进入：cd mysql-5.6.43\n</p>\n<p>\n	二、cmake编译 &amp;&amp; 安装\n</p>\n<p>\n	cmake -DCMAKE_INSTALL_PREFIX=/home/mysql -DMYSQL_DATADIR=/home/mysql/data -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci\n</p>\n<p>\n	make &amp;&amp; make install\n</p>\n<p>\n	三、设置mysql组、并且创建一个mysql用户\n</p>\n<p>\n	groupadd mysql\n</p>\n<p>\n	useradd <span class=\"hljs-attribute\">-g</span> mysql <span class=\"hljs-attribute\">-s</span> /sbin/nologin mysql\n</p>\n<p>\n	检查是否成功：\n</p>\n<p>\n	cat /etc/group | grep mysql\n</p>\n<p>\n	cat /etc/passwd | grep mysql\n</p>\n<p>\n	四、给mysql安装目录权限mysql:mysql\n</p>\n<p>\n	chown -R mysql:mysql /home/mysql\n</p>\n<p>\n	五、初始化的一些配置\n</p>\n<p>\n	1）数据初始化\n</p>\n<p>\n	./scripts/mysql_install_db --basedir=/home/mysql --datadir=/home/mysql/data --user=mysql\n</p>\n<p>\n	2）拷贝服务脚本到init.d中\n</p>\n<p>\n	cp support-files/mysql.server /etc/init.d/mysql\n</p>\n<p>\n	chkconfig mysql on\n</p>\n<p>\n	3）启动\n</p>\n<p>\n	<strong>service mysql start</strong>\n</p>\n<p>\n	<strong><span style=\"color:#E53333;\">注意：</span></strong>\n</p>\n<p>\n	<strong><span style=\"color:#E53333;\">my.cnf中datadir的路径改为/home/mysql/data   （我们自己设置的目录）</span></strong>\n</p>\n<p>\n	<br />\n</p>', 1567149276, 0);
INSERT INTO `article` VALUES (1390, 5, '基于docker搭建mysql主从复制', '<p>\n	一、通过docker安装mysql，我在这里选择是的5.6版本\n</p>\n<p>\n	1）搜索从docker啦取mysql镜像\n</p>\n<p>\n	<strong>docker pull mysql:5.6</strong> \n</p>\n<p>\n	2）使用本镜像启动两个mysql容器（主、从容器）\n</p>\n<p>\n	master（主）\n</p>\n<p>\n	<strong>docker run -p 3316:3306 --name master-mysql -e </strong><strong>MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6</strong> \n</p>\n<p>\n	slave（从）\n</p>\n<p>\n	<strong>docker run -p 3317:3306 --name slave-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6</strong> \n</p>\n<p>\n	参数解析：\n</p>\n<p>\n	-p 将容器的 3306 端口映射到主机的 3306 端口。\n</p>\n<p>\n	--name 使用docker镜像mysql:5.6，将容器命名为mastermysql。\n</p>\n<p>\n	-e -e MYSQL_ROOT_PASSWORD=123456 初始化密码。\n</p>\n<p>\n	-d 后台运行容器，并返回容器ID。\n</p>\n<p>\n	查看容器是否正常运行：<strong>docker ps</strong> \n</p>\n<p>\n	二、配置mysql主服务器（Master）\n</p>\n<p>\n	1）进入mysql主服务器内部\n</p>\n<p>\n	<strong>docker exec -it e8355163bbbc /bin/bash</strong> \n</p>\n<p>\n	2）编辑my.cnf\n</p>\n<p>\n	<strong>cd /etc/mysql</strong> \n</p>\n<p>\n	编辑 my.cnf（vim my.cnf）\n</p>\n<p>\n	<span style=\"color:#E53333;\">注意：可能会提示vim没有安装，可以运行 apt-get install vim 安装，然后再执行vim my.cnf</span> \n</p>\n<p>\n	<span style=\"color:#E53333;\"><span style=\"color:;\"></span></span>在末尾处添加\n</p>\n<p>\n	[mysqld]<br />\nserver-id=100<br />\nlog-bin=mysql-bin\n</p>\n<p>\n	配置完成后需要重启mysql，重启过程中docker镜像也会停止，所以也需要重启一下镜像\n</p>\n<p>\n	<strong>service mysql restart</strong> \n</p>\n<p>\n	<strong>docker start mysql-master</strong> \n</p>\n<p>\n	3）下一步在Master数据库创建数据同步用户，授予用户 slave REPLICATION SLAVE权限和REPLICATION CLIENT权限，用于在主从库之间同步数据。\n</p>\n<p>\n	<strong>CREATE USER \'slave\'@\'%\' IDENTIFIED BY \'123456\';</strong> \n</p>\n<p>\n	<strong>GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO \'slave\'@\'%\';</strong> \n</p>\n<p>\n	三、配置mysql从服务器（Slave）\n</p>\n<p>\n	<br />\n</p>\n<p>\n	1）进入mysql从服务器内部\n</p>\n<p>\n	<strong>docker exec -it 从服务器id /bin/bash</strong> \n</p>\n<p>\n	2）编辑my.cnf\n</p>\n<p>\n	<strong>cd /etc/mysql</strong> \n</p>\n<p>\n	编辑 my.cnf（vim my.cnf）\n</p>\n<p>\n	<span style=\"color:#E53333;\">注意：可能会提示vim没有安装，可以运行 apt-get install vim 安装，然后再执行vim my.cnf</span> \n</p>\n<p>\n	<span style=\"color:#E53333;\"><span style=\"color:;\"></span></span>在末尾处添加\n</p>\n<p>\n	[mysqld]<br />\nserver-id=101<br />\nlog-bin=mysql-slave-bin\n</p>\n<p>\n	relay_log=edu-mysql-relay-bin\n</p>\n<p>\n	配置完成后需要重启mysql，重启过程中docker镜像也会停止，所以也需要重启一下镜像\n</p>\n<p>\n	<strong>service mysql restart</strong> \n</p>\n<strong>docker start mysql-slave</strong> \n<p>\n	<br />\n</p>\n四、其他设置\n<p>\n	<br />\n</p>\n<p>\n	1）链接Master(主)和Slave(从)\n</p>\n<p>\n	在Master进入<strong>mysql</strong>，执行<strong>show master status;</strong> \n</p>\n<p>\n	<span style=\"color:#E53333;\">File和Position字段的值后面将会用到，在后面的操作完成之前，需要保证Master库不能做任何操作，否则将会引起状态变化，File和Position字段的值变化。</span> \n</p>\n<p>\n	<span style=\"color:#E53333;\"><span style=\"color:;\"></span></span>2）在Slave中进入mysql，执行\n</p>\n<p>\n	change master to master_host=\'172.17.0.2\', master_user=\'slave\', master_password=\'123456\', master_port=3306, master_log_file=\'mysql-bin.000001\', master_log_pos= 433, master_connect_retry=30;\n</p>\n<p>\n	<br />\n</p>\n<p>\n	<strong>命令说明：</strong> \n</p>\n<p>\n	<strong>master_host</strong> ：Master的地址，指的是容器的独立ip,可以通过docker inspect --format=\'{{.NetworkSettings.IPAddress}}\' 容器名称|容器id查询容器的ip\n</p>\n<p>\n	<strong>master_port</strong>：Master的端口号，指的是容器的端口号\n</p>\n<p>\n	<strong>master_user</strong>：用于数据同步的用户\n</p>\n<p>\n	<strong>master_password</strong>：用于同步的用户的密码\n</p>\n<p>\n	<strong>master_log_file</strong>：指定 Slave 从哪个日志文件开始复制数据，即上文中提到的 File 字段的值\n</p>\n<p>\n	<strong>master_log_pos</strong>：从哪个 Position 开始读，即上文中提到的 Position 字段的值\n</p>\n<p>\n	<strong>master_connect_retry</strong>：如果连接失败，重试的时间间隔，单位是秒，默认是60秒\n</p>\n<p>\n	3）在Slave 中的mysql终端执行<strong> show slave status \\G; </strong>用于查看主从同步状态。\n</p>\n<p>\n	<img src=\"/static/upload/111.png\" alt=\"\" />\n</p>\n<p>\n	正常情况下，SlaveIORunning 和 SlaveSQLRunning 都是No，因为我们还没有开启主从复制过程。使用<strong>start slave;</strong>开启主从复制过程，然后再次查询主从同步状态<strong>show slave status \\G;</strong>。\n</p>\n<p>\n	<img src=\"/static/upload/222.png\" alt=\"\" />\n</p>\n<p>\n	好了，现在可以测试了。\n</p>\n<p>\n	<br />\n</p>', 1567307676, 1567610514);
INSERT INTO `article` VALUES (1391, 5, '记录一下修改ubuntu的源', '<p>\n	问：为什么要修改？\n</p>\n<p>\n	答：虽然自带的源够一般使用，但是在国内速度很慢，也可能有一些包不能使用。所以我们要修改为国内的源（这里我选择的是163的）\n</p>\n<p>\n	1）在修改之前我们先备份一下\n</p>\n<p>\n	<strong>cp /etc/apt/sources.list /etc/apt/sources.list.copy</strong>\n</p>\n<p>\n	2）替换 <strong>sources.list </strong>的内容为163的源\n</p>\n<p>\n	deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse<br />\ndeb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse<br />\ndeb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse<br />\ndeb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse<br />\ndeb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse<br />\ndeb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse<br />\ndeb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse<br />\ndeb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse<br />\ndeb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse<br />\ndeb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse\n</p>\n<p>\n	保存\n</p>\n<p>\n	3）更新源\n</p>\n<p>\n	<strong>apt-get update</strong>\n</p>\n<p>\n	<strong>apt-get upgrade</strong>\n</p>\n<p>\n	好了就是这样了\n</p>', 1567429293, 0);
INSERT INTO `article` VALUES (1392, 1, 'PHP通过redis实现消息队列', '<p>\n	在我们开发中有好多并发的场景，如：抢购、抢票、抢红包等。那么用mysql来做可能不是太好，也可能存在锁表的情况。那么消息队列就出来了。\n</p>\n<p>\n	具体消息队列的概念我就不说了，想必看能看到这篇文章的朋友已经对消息队列有了一定的了解了。那么下来我们就开始了。\n</p>\n<p>\n	1.安装php的redis扩展\n</p>\n<p>\n	wget https://github.com/phpredis/phpredis/archive/3.1.4.tar.gz\n</p>\n<p>\n	tar -zxvf 3.1.4.tar.gz <br />\ncd phpredis-3.1.4\n</p>\n<p>\n	phpize\n</p>\n<p>\n	./configure --with-php-config=/Applications/MAMP/bin/php/php7.1.6/bin/php-config <span style=\"color:#E53333;\">(这里我用的是mamp，具体的根据自己的环境链接php-config)</span>\n</p>\n<p>\n	<span style=\"color:#E53333;\"><span style=\"color:;\"></span></span>2.将请求数据通过php存入redis\n</p>\n<p>\n	<div style=\"color:#d4d4d4;background-color:#1e1e1e;font-family:Menlo, Monaco, \'Courier New\', monospace;font-weight:normal;font-size:16px;\">\n		<div>\n			<span style=\"color:#569cd6;\">&lt;?php</span>\n		</div>\n<br />\n		<div>\n			<span style=\"color:#9cdcfe;\">$user_id</span><span style=\"color:#d4d4d4;\"> = </span><span style=\"color:#9cdcfe;\">$argv</span><span style=\"color:#d4d4d4;\">[</span><span style=\"color:#b5cea8;\">1</span><span style=\"color:#d4d4d4;\">]; </span><span style=\"color:#6a9955;\">//模拟用户id</span>\n		</div>\n<br />\n		<div>\n			<span style=\"color:#6a9955;\">// 将请求存入redis</span>\n		</div>\n		<div>\n			<span style=\"color:#9cdcfe;\">$redis</span><span style=\"color:#d4d4d4;\"> = </span><span style=\"color:#569cd6;\">new</span><span style=\"color:#d4d4d4;\"> </span><span style=\"color:#4ec9b0;\">Redis</span><span style=\"color:#d4d4d4;\">();</span>\n		</div>\n		<div>\n			<span style=\"color:#6a9955;\">// 创建链接</span>\n		</div>\n		<div>\n			<span style=\"color:#9cdcfe;\">$redis</span><span style=\"color:#d4d4d4;\">-&gt;</span><span style=\"color:#dcdcaa;\">connect</span><span style=\"color:#d4d4d4;\">(</span><span style=\"color:#ce9178;\">\'127.0.0.1\'</span><span style=\"color:#d4d4d4;\">, </span><span style=\"color:#b5cea8;\">6379</span><span style=\"color:#d4d4d4;\">);</span>\n		</div>\n		<div>\n			<span style=\"color:#6a9955;\">// 开始存入</span>\n		</div>\n		<div>\n			<span style=\"color:#c586c0;\">try</span><span style=\"color:#d4d4d4;\">{</span>\n		</div>\n		<div>\n			<span style=\"color:#d4d4d4;\"> </span><span style=\"color:#9cdcfe;\">$redis</span><span style=\"color:#d4d4d4;\">-&gt;</span><span style=\"color:#dcdcaa;\">lPush</span><span style=\"color:#d4d4d4;\">(</span><span style=\"color:#ce9178;\">\'click\'</span><span style=\"color:#d4d4d4;\">, </span><span style=\"color:#9cdcfe;\">$user_id</span><span style=\"color:#d4d4d4;\">);</span>\n		</div>\n		<div>\n			<span style=\"color:#d4d4d4;\">}</span><span style=\"color:#c586c0;\">catch</span><span style=\"color:#d4d4d4;\">(</span><span style=\"color:#4ec9b0;\">Exception</span><span style=\"color:#d4d4d4;\"> </span><span style=\"color:#9cdcfe;\">$e</span><span style=\"color:#d4d4d4;\">){</span>\n		</div>\n		<div>\n			<span style=\"color:#d4d4d4;\"> </span><span style=\"color:#dcdcaa;\">echo</span><span style=\"color:#d4d4d4;\"> </span><span style=\"color:#9cdcfe;\">$e</span><span style=\"color:#d4d4d4;\">-&gt;</span><span style=\"color:#dcdcaa;\">getMessage</span><span style=\"color:#d4d4d4;\">();</span>\n		</div>\n		<div>\n			<span style=\"color:#d4d4d4;\">}</span>\n		</div>\n<br />\n		<div>\n			<span style=\"color:#dcdcaa;\">echo</span><span style=\"color:#d4d4d4;\"> </span><span style=\"color:#ce9178;\">\"用户id已经存入消息队列</span><span style=\"color:#d7ba7d;\">\\n</span><span style=\"color:#ce9178;\">\"</span><span style=\"color:#d4d4d4;\">;</span>\n		</div>\n	</div>\n3.写一个php处理消息队列中的数据到mysql的守护进程\n</p>\n<p>\n<pre>$redis = new Redis();\n$redis-&gt;pconnect(\'127.0.0.1\',6379);\nwhile(1) {\n  try{\n    $value = $redis-&gt;LPOP(\'click\');\n    /**\n      *可以进行一些逻辑处理，数据库数据的写入等（如果用innodb的话可以进行mysql事务处理）\n     */\n  }\n  catch(Exception $e) {\n    echo $e-&gt;getMessage();\n  }\n}</pre>\n</p>', 1567648313, 0);
INSERT INTO `article` VALUES (1393, 5, 'docker搭建nginx负载均衡服务器', '<div style=\"font-size:16px;\">\n	<span style=\"font-size:20px;font-weight:bold;\">1.什么是负载均衡</span>\n</div>\n<div style=\"font-size:16px;\">\n	负载均衡，英文名称为Load Balance，其含义就是指将负载（工作任务）进行平衡、分摊到多个操作单元上进行运行，例如FTP服务器、Web服务器、企业核心应用服务器和其它主要任务服务器等，从而协同完成工作任务。\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-size:20px;font-weight:bold;\">2.常用负载均衡</span>\n</div>\n<div style=\"font-size:16px;\">\n	负载均衡常用的实现方式为两种类型（一种为：硬件实现，另一种为：软件实现）\n</div>\n<div style=\"font-size:16px;\">\n	1）硬件实现\n</div>\n<div style=\"font-size:16px;\">\n	硬件实现负载均衡有很多，都是商用，而且价格比较贵\n</div>\n<div style=\"font-size:16px;\">\n	2）软件实现\n</div>\n<div style=\"font-size:16px;\">\n	软件实现是基于linux的负载均衡策略，如：nginx、LVS等。<span style=\"color:#E53333;\">（今天我们来说一下通过软件（nginx）实现）</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-size:20px;font-weight:bold;\">3.通过nginx实现负载均衡服务器</span>\n</div>\n<div style=\"font-size:16px;\">\n	由于我是在本机实现，所以我在这里使用docker的nginx镜像实例化几个nginx容器来模拟\n</div>\n<div style=\"font-size:16px;\">\n	1）先pull一个nginx\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">docker pull nginx:1.15.12</span>\n</div>\n<div style=\"font-size:16px;\">\n	2）实例化一个容器（运行）\n</div>\n<div style=\"font-size:16px;\">\n	d<span style=\"font-weight:bold;\">ocker run --name master-nginx -p 9080:80 -d nginx:1.15.12</span>\n</div>\n<div style=\"font-size:16px;\">\n	--name 这个nginx容器的名字\n</div>\n<div style=\"font-size:16px;\">\n	-p 容器的80端口映射到本机的9080端口\n</div>\n<div style=\"font-size:16px;\">\n	-d 后台守护进程运行\n</div>\n<div style=\"font-size:16px;\">\n	3）进入这个容器配置nginx的负载均衡\n</div>\n<div style=\"font-size:16px;\">\n	3-1）在这里我们进入nginx的配置文件\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">cd /etc/nginx/conf.d</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">vim default.conf </span><span style=\"color:#E53333;\">（可能会提示vim不存在，这时候执行 apt-get update 更新一下包，然后执行 apt-get install vim 安装vim后再次运行vim nginx.conf）</span>\n</div>\n<div style=\"font-size:16px;\">\n	添加：\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">upstream myPond {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; server 127.0.0.1:8000 weight=3;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; server 127.0.0.1:8001;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; server 127.0.0.1:8002;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; server 127.0.0.1:8003;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">}</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">location修改为：\nlocation / {\n&nbsp; proxy_pass http://myPond;\n}</span>\n</div>\n<div style=\"font-size:16px;\">\n	保存，重启容器\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">docker restart 容器id</span>\n</div>\n<div style=\"font-size:16px;\">\n	在这里我们的负载均衡器就配置完成了\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-size:20px;font-weight:bold;\">4）</span>\n</div>\n<div style=\"font-size:16px;\">\n	访问<a href=\"http://127.0.0.1:9080/\"><span style=\"color:#003884;text-decoration:underline;\">http://127.0.0.1:9080/</span></a>\n</div>\n<div style=\"font-size:16px;\">\n	提示：\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-size:32px;font-weight:bold;\">An error occurred.</span>\n</div>\n<div style=\"font-size:16px;\">\n	Sorry, the page you are looking for is currently unavailable.\n</div>\n<div style=\"font-size:16px;\">\n	Please try again later.\n</div>\n<div style=\"font-size:16px;\">\n	If you are the system administrator of this resource then you should check\nthe error log for details.\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-style:italic;\">Faithfully yours, nginx.</span>\n</div>\n<div style=\"font-size:16px;\">\n	这里是因为我们还没有配置：\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server 127.0.0.1:8000;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server 127.0.0.1:8001;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server 127.0.0.1:8002;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server 127.0.0.1:8003;</span>\n</div>\n<div style=\"font-size:16px;\">\n	1）再次进入nginx容器\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">docker exec -it 容器id /bin/bash</span>\n</div>\n<div style=\"font-size:16px;\">\n	2）创建多站点\n</div>\n<div style=\"font-size:16px;\">\n	进入nginx多站点配置文件夹\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">cd /etc/nginx/conf.d/</span>\n</div>\n<div style=\"font-size:16px;\">\n	vim 创建 a.conf、b.conf、c.conf、d.conf\n</div>\n<div style=\"font-size:16px;\">\n	内容分别为：\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8000;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; location / {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index index.html;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp; /home/www/a;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; }</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">}</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8001;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; location / {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index index.html;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp; /home/www/b;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; }</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">}</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8002;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; location / {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index index.html;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp; /home/www/c;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; }</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">}</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">server {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8003;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; location / {</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index index.html;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp; /home/www/d;</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&nbsp;&nbsp;&nbsp; }</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">}</span>\n</div>\n<div style=\"font-size:16px;\">\n	我们在一下文件中分别写入：\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">/home/www/a/index.html</span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&lt;h1&gt;Server:127.0.0.1:8000&lt;/h1&gt; </span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">/home/www/b/index.html\n&lt;h1&gt;Server:127.0.0.1:8001&lt;/h1&gt; </span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">/home/www/c/index.html\n&lt;h1&gt;Server:127.0.0.1:8002&lt;/h1&gt; </span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">/home/www/d/index.html </span>\n</div>\n<div style=\"font-size:16px;\">\n	<span style=\"font-weight:bold;\">&lt;h1&gt;Server:127.0.0.1:8003&lt;/h1&gt;</span>\n</div>\n<div style=\"font-size:16px;\">\n	最后我们测试一下\n</div>\n<div>\n	<img alt=\"\" src=\"http://i9.taou.com/maimai/p/21417/1206_81_22ZsRrlKodoxIrvx\" style=\"width:620px;\" width=\"754\" height=\"334\" />\n</div>\n<div style=\"font-size:16px;\">\n	<br />\n</div>\n<div style=\"font-size:16px;\">\n	<br />\n</div>\n<div style=\"font-size:16px;\">\n	<br />\n</div>\n<div>\n	<img alt=\"\" src=\"http://i9.taou.com/maimai/p/21417/1205_81_2n4Zamz3pkx0jzhZ\" style=\"width:620px;\" width=\"756\" height=\"404\" />\n</div>\n<div style=\"font-size:16px;\">\n	<br />\n</div>\n<div>\n	<img alt=\"\" src=\"http://i9.taou.com/maimai/p/21417/1207_81_36Vey17gnJgu7ZJh\" style=\"width:620px;\" width=\"756\" height=\"390\" />\n</div>', 1567831029, 0);
INSERT INTO `article` VALUES (1396, 1, 'PHPServerMonitor搭建服务器监控', '<p>\n	在我们软件开发中，尤其是较多的时候，可能会进行一些系统或者网站的监控。那么今天我就介绍一下如何用PHPServerMonitor监控你的服务器。\n</p>\n<h3>\n	1.什么是PHP Server Monitor ？\n</h3>\n<p>\n	PHP Server Monitor是一个脚本，用来监控及检查您的网站和服务器的启动和运行健康状态。它配备了一个基于web的用户接口，您可以管理您的网站和服务及您的服务器。可以管理每个用户的移动电话号码和电子邮件地址。\n</p>\n<h3>\n	2.搭建过程\n</h3>\n<div>\n	<span style=\"color:#E53333;\">在搭建之前请确保已经安装好php+mysql+apache环境</span><br />\n</div>\n<div>\n	<p>\n		1）下载包\n	</p>\n	<p>\n		下载：<strong>wget https://nchc.dl.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.zip</strong> \n	</p>\n	<p>\n		解压：<strong>unzip </strong><strong>phpservermon-3.2.0.zip</strong> \n	</p>\n	<p>\n		2）移动至网站根目录\n	</p>\n	<p>\n		<strong>mv </strong><strong>phpservermon-3.2.0 /www/</strong> \n	</p>\n	<p>\n		3）访问Install.php进行安装\n	</p>\n	<p>\n		浏览器访问：<strong>http://localhost/phpservermon-3.2.0/install.php</strong> \n	</p>\n	<p>\n		<img src=\"/static/upload/1.png\" alt=\"\" /> \n	</p>\n	<p>\n		3-1）点击下一步，填写相关信息\n	</p>\n	<p>\n		<img src=\"/static/upload/7.png\" alt=\"\" /> \n	</p>\n	<p>\n		3-2）手动创建配置文件\n	</p>\n	<p>\n		这时候可能会出现配置文件文件无法创建，请手动创建。然后复制text中的代码，在根目录下创建config.php文件，把复制的配置代码写进去保存重新提交。\n	</p>\n	<p>\n		配置代码示例：\n	</p>\n	<p>\n		&lt;?php<br />\ndefine(\'PSM_DB_HOST\', \'localhost\');<br />\ndefine(\'PSM_DB_PORT\', \'3306\');<br />\ndefine(\'PSM_DB_NAME\', \'phpservermon\');<br />\ndefine(\'PSM_DB_USER\', \'root\');<br />\ndefine(\'PSM_DB_PASS\', \'root\');<br />\ndefine(\'PSM_DB_PREFIX\', \'psm_\');<br />\ndefine(\'PSM_BASE_URL\', \'http://localhost/phpservermon-3.2.0\');<br />\n3-4）创建管理员用户名密码等\n	</p>\n	<p>\n		<img src=\"/static/upload/2.png\" alt=\"\" /> \n	</p>\n	<p>\n		3-5）完成创建，运行\n	</p>\n	<p>\n		登录\n	</p>\n	<p>\n		<img src=\"/static/upload/3.png\" alt=\"\" /> \n	</p>\n	<p>\n		主页面\n	</p>\n	<p>\n		<img src=\"/static/upload/4.png\" alt=\"\" /> \n	</p>\n	<p>\n		4）都已经安装好了，（3.0.1版本之后添加了中文翻译）所以我们现在可以设置中文\n	</p>\n	<p>\n		<img src=\"/static/upload/5.png\" alt=\"\" /> \n	</p>\n	<p>\n		好了下面就是PHPServerMonitor的中文面板了\n	</p>\n	<p>\n		<img src=\"/static/upload/6.png\" alt=\"\" /> \n	</p>\n	<p>\n		<br />\n	</p>\n	<p>\n		<br />\n	</p>\n</div>', 1568022956, 1568024330);
COMMIT;

-- ----------------------------
-- Table structure for article_class
-- ----------------------------
DROP TABLE IF EXISTS `article_class`;
CREATE TABLE `article_class` (
  `article_class_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文章分类id',
  `name` varchar(255) NOT NULL COMMENT '分类名称',
  PRIMARY KEY (`article_class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='文章分类';

-- ----------------------------
-- Records of article_class
-- ----------------------------
BEGIN;
INSERT INTO `article_class` VALUES (1, 'PHP');
INSERT INTO `article_class` VALUES (2, 'Go语言');
INSERT INTO `article_class` VALUES (3, 'Python');
INSERT INTO `article_class` VALUES (4, '前端');
INSERT INTO `article_class` VALUES (5, '运维');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `username` varchar(32) NOT NULL COMMENT '用户名',
  `password` varchar(32) NOT NULL COMMENT '密码',
  `admin` int(11) NOT NULL DEFAULT '0' COMMENT '1管理员0普通成员',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, 'admin', '202cb962ac59075b964b07152d234b70', 1);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
